<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>按起终点经纬度规划路线</title>
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <style type="text/css">
        #panel {
            position: fixed;
            background-color: white;
            max-height: 90%;
            overflow-y: auto;
            top: 10px;
            right: 10px;
            width: 280px;
        }
    </style>
    <script type="text/javascript" src="/public/js/jquery.min.js"></script>
    <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.0&key=ae82d843d0a242f4afc31640c5696399&plugin=AMap.Walking"></script>
    <script type="text/javascript" src="http://cache.amap.com/lbs/static/addToolbar.js"></script>
</head>
<body>
<?php foreach($customerLocation as $val) :?>
<input name="customer_location" type="hidden" value="<?=$val?>">
<?php endforeach?>
<input name="store_location" type="hidden" value="<?=sprintf("%s,%s", $storeLocation['lng'], $storeLocation['lat'])?>">
<div id="container"></div>
<script type="text/javascript">
    var storeLocation = $("input[name='store_location']").val().split(",");

    var map = new AMap.Map("container", {
        resizeEnable: true,
        center: storeLocation,//地图中心点
        zoom: 14 //地图显示的缩放级别
    });

    //步行导航
    $("input[name='customer_location']").each(function(){
        var walking = new AMap.Walking({
            map: map,
            autoFitView: false,
            hideMarkers: true
        });

        var customerLocation = $(this).val().split(",");
        
        //添加客户标记，并使用自己的icon
        new AMap.Marker({
            map: map,
            position: customerLocation,
            icon: new AMap.Icon({            
                size: new AMap.Size(40, 40),  //图标大小
                image: "http://t6.ueu.cn/public/images/customer_icon.png"
            })        
        }); 
        walking.search(storeLocation, customerLocation);
       
    })  
    //添加商家标记，并使用自己的icon
    new AMap.Marker({
        map: map,
        position: storeLocation,
        icon: new AMap.Icon({            
            size: new AMap.Size(40, 40),  //图标大小
            image: "http://t6.ueu.cn/public/images/store_icon.png"
        })        
    });   
</script>
</body>
</html>